package com.zb.vo;

import com.zb.entity.ZjWorkSet;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @Author WEN
 * @Date 2023/7/26 0026
 **/
@Data
@ApiModel("工单设置实体封装")
public class WorkSetVo {
    @NotNull(message = "工单设置ID不能为空")
    @ApiModelProperty(value = "工单设置ID，必传", required = true, example = "")
    private Long id;

    @NotNull(message = "是否允许查询全部工单项不能为空")
    @ApiModelProperty(value = "是否允许查询全部工单：false-仅查看自己的工单，true-可查看全部工单", required = true, example = "true")
    private Boolean selectAllOrder;

    @NotNull(message = "是否启用重复报单项不能为空")
    @ApiModelProperty(value = "是否启用重复报单：false-否，true-是", required = true, example = "false")
    private Boolean enableRepeatOrder;

    @ApiModelProperty(value = "移动端重复报单：false-否，true-是", example = "false")
    private Boolean repeatByMobile;

    @ApiModelProperty(value = "客服端重复报单：false-否，true-是", example = "false")
    private Boolean repeatByService;

    @ApiModelProperty(value = "是否启用重复报单提示：false-否，true-是", required = true, example = "true")
    private Boolean enableRepeatOrderTip;

    @ApiModelProperty(value = "移动端重复报单提示：false-否，true-是", example = "true")
    private Boolean repeatByMobileTip;

    @ApiModelProperty(value = "客服端重复报单提示：false-否，true-是", example = "true")
    private Boolean repeatByServiceTip;

    @NotNull(message = "是否启用产品名称选项不能为空")
    @ApiModelProperty(value = "是否启用产品名称：false-否，true-是", required = true, example = "false")
    private Boolean enableProName;

    @NotNull(message = "是否启用产品型号选项不能为空")
    @ApiModelProperty(value = "是否启用产品型号：false-否，true-是", required = true, example = "false")
    private Boolean enableProModel;

    @NotNull(message = "是否启用产品编码选项不能为空")
    @ApiModelProperty(value = "是否启用产品编码：false-否，true-是", required = true, example = "false")
    private Boolean enableProCode;

    @NotNull(message = "是否启用用户账号选项不能为空")
    @ApiModelProperty(value = "是否启用用户账号：false-否，true-是", required = true, example = "false")
    private Boolean enableUserAccount;

    @NotNull(message = "是否启用用户姓名选项不能为空")
    @ApiModelProperty(value = "是否启用用户姓名：false-否，true-是", required = true, example = "true")
    private Boolean enableUserName;

    @NotNull(message = "是否启用用户手机号选项不能为空")
    @ApiModelProperty(value = "是否启用用户手机号：false-否，true-是", required = true, example = "true")
    private Boolean enableUserPhone;

    @NotNull(message = "是否启用用户地址选项不能为空")
    @ApiModelProperty(value = "是否启用用户地址：false-否，true-是", required = true, example = "false")
    private Boolean enableUserAddress;

    @NotNull(message = "是否完工修改选项不能为空")
    @ApiModelProperty(value = "是否完工修改，即工单申请结单时，还可以修改，结单后不可以：false-否，true-是", required = true, example = "false")
    private Boolean finishUpdate;

    @ApiModelProperty(value = "是否开启移动端维修师傅修改权限，即申请结单时，还可以修改， 结单后不可修改，与finishUpdate结合使用， 当finishUpdate为true时才生效", example = "false")
    private Boolean openRepairAuth;

    @NotNull(message = "报单是否携带登记信息选项不能为空")
    @ApiModelProperty(value = "报单是否携带登记信息：false-否，true-是", required = true, example = "true")
    private Boolean carryRegistInfo;

    @NotNull(message = "是否显示关联备件项不能为空")
    @ApiModelProperty(value = "是否显示关联备件：false-否，true-是", required = true, example = "true")
    private Boolean showRelationSpare;

    @ApiModelProperty(value = "网点未接单自动退回时间（小时）")
    private Integer networkReceiveTimeout;

    @ApiModelProperty(value = "网点未派单自动退回时间（小时）")
    private Integer networkDispatchTimeout;

    @ApiModelProperty(value = "工程师未接单自动退回时间（小时）")
    private Integer engineerReceiveTimeout;

    @ApiModelProperty(value = "创建时间", hidden = true)
    private Date createTime;

    @ApiModelProperty(value = "更新时间", hidden = true)
    private Date updateTime;

    public static WorkSetVo beanToVo(ZjWorkSet workSet) {
        WorkSetVo vo = new WorkSetVo();
        BeanUtils.copyProperties(workSet, vo);
        vo.setCreateTime(workSet.getGmtCreate());
        vo.setUpdateTime(workSet.getGmtUpdate());
        return vo;
    }

    public static ZjWorkSet voToBean(WorkSetVo vo) {
        ZjWorkSet workSet = new ZjWorkSet();
        BeanUtils.copyProperties(vo, workSet);
        return workSet;
    }
}
